#include <iostream>
#include <stdio.h>

class Singleton1
{
	public:
		static Singleton1* GetInstance(void)
		{
			if(nullptr == m_instance)
			{
				m_instance = new Singleton1();
			}
			return m_instance;
		}
		static void ReleaseInstance(void)
		{
			if(m_instance)
			{
				delete m_instance;
				m_instance = nullptr;
			}
		}
	private:
		Singleton1(){}
		virtual ~Singleton1()
		{
			printf("Singleton1 destruct\n");
		}
		Singleton1(const Singleton1&) = delete;
		Singleton1& operator=(const Singleton1&) = delete;

		static Singleton1* m_instance;
};

template <typename T>
class Singleton {
public:
    static T& getInstance()
    {
        static T ins;

        return ins;
    }

    Singleton(const Singleton& ins) = delete;
    Singleton& operator =(const Singleton& ins) = delete;

protected:
    struct Unique {};
    Singleton() = default;
};

class YouClass : public Singleton<YouClass> {
public:
    YouClass(Unique) {}

    YouClass(const YouClass&) = delete;
    YouClass& operator=(const YouClass&) = delete;
};

Singleton1* Singleton1::m_instance = nullptr;
